package itbour.onetouchshow.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by onetouch on 2017/12/1.
 */

public class UserDetailInfoBean implements Parcelable {

    public static final Parcelable.Creator<UserDetailInfoBean> CREATOR = new Parcelable.Creator<UserDetailInfoBean>() {
        @Override
        public UserDetailInfoBean createFromParcel(Parcel source) {
            return new UserDetailInfoBean(source);
        }

        @Override
        public UserDetailInfoBean[] newArray(int size) {
            return new UserDetailInfoBean[size];
        }
    };
    /**
     * mobile : {"zone":"","mobile":"13469974378"}
     * wechat : {"token":"161763628","nickName":"俊仔","union":"2.0:nNnGHQHaDltnchrnsZs3/jVZ8IE=","avatarUrl":""}
     * QQ : {}
     * sinaWeibo : {}
     * userInfo : {"sign":"我的俊俊我做主","userId":299188,"nickName":"小俊子","avatarUrl":"http://itbour-user.oss-cn-hangzhou.aliyuncs.com/image/U126431/2017/11/15/112927958_OxC1ylRyxRlc3CkcSpJ5.jpg?x-oss-process=image/resize,m_pad,h_468,w_468,color_fafafa","evaluation":"0"}
     */

    private MobileBean mobile;
    private WechatBean wechat;
    private QQBean QQ;
    private SinaWeiboBean sinaWeibo;
    private UserInfoBean userInfo;

    public UserDetailInfoBean() {
    }

    protected UserDetailInfoBean(Parcel in) {
        this.mobile = in.readParcelable(MobileBean.class.getClassLoader());
        this.wechat = in.readParcelable(WechatBean.class.getClassLoader());
        this.QQ = in.readParcelable(QQBean.class.getClassLoader());
        this.sinaWeibo = in.readParcelable(SinaWeiboBean.class.getClassLoader());
        this.userInfo = in.readParcelable(UserInfoBean.class.getClassLoader());
    }

    public boolean getIsVip() {

        return userInfo.getVip().getIsVip() == 1;
    }

    public MobileBean getMobile() {
        return mobile;
    }

    public void setMobile(MobileBean mobile) {
        this.mobile = mobile;
    }

    public WechatBean getWechat() {
        return wechat;
    }

    public void setWechat(WechatBean wechat) {
        this.wechat = wechat;
    }

    public QQBean getQQ() {
        return QQ;
    }

    public void setQQ(QQBean QQ) {
        this.QQ = QQ;
    }

    public SinaWeiboBean getSinaWeibo() {
        return sinaWeibo;
    }

    public void setSinaWeibo(SinaWeiboBean sinaWeibo) {
        this.sinaWeibo = sinaWeibo;
    }

    public UserInfoBean getUserInfo() {
        return userInfo;
    }

    public void setUserInfo(UserInfoBean userInfo) {
        this.userInfo = userInfo;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeParcelable(this.mobile, flags);
        dest.writeParcelable(this.wechat, flags);
        dest.writeParcelable(this.QQ, flags);
        dest.writeParcelable(this.sinaWeibo, flags);
        dest.writeParcelable(this.userInfo, flags);
    }

    public static class MobileBean implements Parcelable {
        public static final Creator<MobileBean> CREATOR = new Creator<MobileBean>() {
            @Override
            public MobileBean createFromParcel(Parcel source) {
                return new MobileBean(source);
            }

            @Override
            public MobileBean[] newArray(int size) {
                return new MobileBean[size];
            }
        };
        /**
         * zone :
         * mobile : 13469974378
         */

        private String zone;
        private String mobile;

        public MobileBean() {
        }

        protected MobileBean(Parcel in) {
            this.zone = in.readString();
            this.mobile = in.readString();
        }

        public String getZone() {
            return zone;
        }

        public void setZone(String zone) {
            this.zone = zone;
        }

        public String getMobile() {
            return mobile;
        }

        public void setMobile(String mobile) {
            this.mobile = mobile;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.zone);
            dest.writeString(this.mobile);
        }
    }

    public static class WechatBean implements Parcelable {
        public static final Creator<WechatBean> CREATOR = new Creator<WechatBean>() {
            @Override
            public WechatBean createFromParcel(Parcel source) {
                return new WechatBean(source);
            }

            @Override
            public WechatBean[] newArray(int size) {
                return new WechatBean[size];
            }
        };
        /**
         * token : 161763628
         * nickName : 俊仔
         * union : 2.0:nNnGHQHaDltnchrnsZs3/jVZ8IE=
         * avatarUrl :
         */

        private String token;
        private String nickName;
        private String union;
        private String avatarUrl;

        public WechatBean() {
        }

        protected WechatBean(Parcel in) {
            this.token = in.readString();
            this.nickName = in.readString();
            this.union = in.readString();
            this.avatarUrl = in.readString();
        }

        public String getToken() {
            return token;
        }

        public void setToken(String token) {
            this.token = token;
        }

        public String getNickName() {
            return nickName;
        }

        public void setNickName(String nickName) {
            this.nickName = nickName;
        }

        public String getUnion() {
            return union;
        }

        public void setUnion(String union) {
            this.union = union;
        }

        public String getAvatarUrl() {
            return avatarUrl;
        }

        public void setAvatarUrl(String avatarUrl) {
            this.avatarUrl = avatarUrl;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.token);
            dest.writeString(this.nickName);
            dest.writeString(this.union);
            dest.writeString(this.avatarUrl);
        }
    }

    public static class QQBean implements Parcelable {
        public static final Creator<QQBean> CREATOR = new Creator<QQBean>() {
            @Override
            public QQBean createFromParcel(Parcel source) {
                return new QQBean(source);
            }

            @Override
            public QQBean[] newArray(int size) {
                return new QQBean[size];
            }
        };

        public QQBean() {
        }

        protected QQBean(Parcel in) {
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
        }
    }

    public static class SinaWeiboBean implements Parcelable {
        public static final Creator<SinaWeiboBean> CREATOR = new Creator<SinaWeiboBean>() {
            @Override
            public SinaWeiboBean createFromParcel(Parcel source) {
                return new SinaWeiboBean(source);
            }

            @Override
            public SinaWeiboBean[] newArray(int size) {
                return new SinaWeiboBean[size];
            }
        };

        public SinaWeiboBean() {
        }

        protected SinaWeiboBean(Parcel in) {
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
        }
    }

    public static class UserInfoBean implements Parcelable {
        public static final Creator<UserInfoBean> CREATOR = new Creator<UserInfoBean>() {
            @Override
            public UserInfoBean createFromParcel(Parcel source) {
                return new UserInfoBean(source);
            }

            @Override
            public UserInfoBean[] newArray(int size) {
                return new UserInfoBean[size];
            }
        };
        /**
         * sign : 我的俊俊我做主
         * userId : 299188
         * nickName : 小俊子
         * avatarUrl : http://itbour-user.oss-cn-hangzhou.aliyuncs.com/image/U126431/2017/11/15/112927958_OxC1ylRyxRlc3CkcSpJ5.jpg?x-oss-process=image/resize,m_pad,h_468,w_468,color_fafafa
         * evaluation : 0
         * <p>
         * "isVip" : 1,                    // 当前时间是否为 vip, 0 不是 vip, 1 是 vip
         */


        private String sign;
        private int userId;
        private String nickName;
        private String avatarUrl;
        private String evaluation;
        private RewardBean reward;
        private Vip vip;
        private Wallet wallet;

        public UserInfoBean() {
        }

        protected UserInfoBean(Parcel in) {
            this.sign = in.readString();
            this.userId = in.readInt();
            this.nickName = in.readString();
            this.avatarUrl = in.readString();
            this.evaluation = in.readString();
            this.reward = in.readParcelable(RewardBean.class.getClassLoader());
            this.vip = in.readParcelable(Vip.class.getClassLoader());
            this.wallet = in.readParcelable(Wallet.class.getClassLoader());
        }

        public RewardBean getReward() {
            return reward;
        }

        public Vip getVip() {
            return vip;
        }

        public void setVip(Vip vip) {
            this.vip = vip;
        }

        public Wallet getWallet() {
            return wallet;
        }

        public void setWallet(Wallet wallet) {
            this.wallet = wallet;
        }

        public String getSign() {
            return sign;
        }

        public void setSign(String sign) {
            this.sign = sign;
        }

        public int getUserId() {
            return userId;
        }

        public void setUserId(int userId) {
            this.userId = userId;
        }

        public String getNickName() {
            return nickName;
        }

        public void setNickName(String nickName) {
            this.nickName = nickName;
        }

        public String getAvatarUrl() {
            return avatarUrl;
        }

        public void setAvatarUrl(String avatarUrl) {
            this.avatarUrl = avatarUrl;
        }

        public String getEvaluation() {
            return evaluation;
        }

        public void setEvaluation(String evaluation) {
            this.evaluation = evaluation;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.sign);
            dest.writeInt(this.userId);
            dest.writeString(this.nickName);
            dest.writeString(this.avatarUrl);
            dest.writeString(this.evaluation);
            dest.writeParcelable(this.reward, flags);
            dest.writeParcelable(this.vip, flags);
            dest.writeParcelable(this.wallet, flags);
        }
    }

    //V1.7收益
    public static class RewardBean implements Parcelable {

        public static final Creator<RewardBean> CREATOR = new Creator<RewardBean>() {
            @Override
            public RewardBean createFromParcel(Parcel in) {
                return new RewardBean(in);
            }

            @Override
            public RewardBean[] newArray(int size) {
                return new RewardBean[size];
            }
        };
        /**
         * "totalReward" : 200000,             // 总计收益, 单位: 分
         * "balance" : 100000,                 // 余额, 单位: 分,
         * "alreadyCash" : 50000,              // 已提现金额, 单位: 分
         * "processCash" : 50000,              // 处理提现中金额, 单位: 分
         * "minDeposit" : 500,                 // 用户单笔提现的最小额度 单位: 分
         * "maxDeposit" : 1000000,             // 用户单笔提现的最大额度 单位: 分
         * "times" : 5,                        // 用户每日提现次数上限 单位: 次
         * "cashThreshold" : 500000,           // 用户提现门槛值, 单位: 分
         */

        private long totalReward;
        private long balance;
        private long alreadyCash;
        private long processCash;
        private int minDeposit;
        private int maxDeposit;
        private int times;
        private int cashThreshold;

        protected RewardBean(Parcel in) {
            totalReward = in.readLong();
            balance = in.readLong();
            alreadyCash = in.readLong();
            processCash = in.readLong();
            minDeposit = in.readInt();
            maxDeposit = in.readInt();
            times = in.readInt();
            cashThreshold = in.readInt();
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeLong(totalReward);
            dest.writeLong(balance);
            dest.writeLong(alreadyCash);
            dest.writeLong(processCash);
            dest.writeInt(minDeposit);
            dest.writeInt(maxDeposit);
            dest.writeInt(times);
            dest.writeInt(cashThreshold);
        }

        @Override
        public int describeContents() {
            return 0;
        }

        public long getTotalReward() {
            return totalReward;
        }

        public long getBalance() {
            return balance;
        }

        public long getAlreadyCash() {
            return alreadyCash;
        }

        public long getProcessCash() {
            return processCash;
        }

        public int getMinDeposit() {
            return minDeposit;
        }

        public int getMaxDeposit() {
            return maxDeposit;
        }

        public int getTimes() {
            return times;
        }

        public int getCashThreshold() {
            return cashThreshold;
        }
    }

    //v1.4会员
    public static class Vip implements Parcelable {

        public static final Creator<Vip> CREATOR = new Creator<Vip>() {
            @Override
            public Vip createFromParcel(Parcel in) {
                return new Vip(in);
            }

            @Override
            public Vip[] newArray(int size) {
                return new Vip[size];
            }
        };
        /**
         * "isVip" : 1,                    // 当前时间是否为 vip, 0 不是 vip, 1 是 vip
         * // 当 isVip 为1时, 下列字段有效, 否则无意义
         * "level" : 10,                   // 会员级别, 10 标记普通会员, 预留字段,
         * "expiryTime" : "2018-07-08",    // 会员过期时间
         * "expiryTimeStamp" : 1521687290, // 会员过期时间戳, 10 位
         * "expireDayNum" : 3, // 会员离过期剩余天数
         */

        private int isVip;
        private int level;
        private String expiryTime;
        private int expiryTimeStamp;
        private int expireDayNum;

        protected Vip(Parcel in) {
            isVip = in.readInt();
            level = in.readInt();
            expiryTime = in.readString();
            expiryTimeStamp = in.readInt();
            expireDayNum = in.readInt();
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(isVip);
            dest.writeInt(level);
            dest.writeString(expiryTime);
            dest.writeInt(expiryTimeStamp);
            dest.writeInt(expireDayNum);
        }

        @Override
        public int describeContents() {
            return 0;
        }

        public int getIsVip() {
            return isVip;
        }

        public void setIsVip(int isVip) {
            this.isVip = isVip;
        }

        public int getLevel() {
            return level;
        }

        public void setLevel(int level) {
            this.level = level;
        }

        public String getExpiryTime() {
            return expiryTime;
        }

        public void setExpiryTime(String expiryTime) {
            this.expiryTime = expiryTime;
        }

        public int getExpiryTimeStamp() {
            return expiryTimeStamp;
        }

        public void setExpiryTimeStamp(int expiryTimeStamp) {
            this.expiryTimeStamp = expiryTimeStamp;
        }

        public int getExpireDayNum() {
            return expireDayNum;
        }

        public void setExpireDayNum(int expireDayNum) {
            this.expireDayNum = expireDayNum;
        }


    }

    //v1.4
    public static class Wallet implements Parcelable {

        public static final Creator<Wallet> CREATOR = new Creator<Wallet>() {
            @Override
            public Wallet createFromParcel(Parcel in) {
                return new Wallet(in);
            }

            @Override
            public Wallet[] newArray(int size) {
                return new Wallet[size];
            }
        };
        /**
         * "pointBalance" : 60000,              // 积分余额, 浮点型
         * "pointBalanceUnit" : "秀米"          // 积分单位
         */

        private String pointBalance;
        private String pointBalanceUnit;

        protected Wallet(Parcel in) {
            pointBalance = in.readString();
            pointBalanceUnit = in.readString();
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(pointBalance);
            dest.writeString(pointBalanceUnit);
        }

        @Override
        public int describeContents() {
            return 0;
        }

        public String getPointBalance() {
            return pointBalance;
        }

        public void setPointBalance(String pointBalance) {
            this.pointBalance = pointBalance;
        }

        public String getPointBalanceUnit() {
            return pointBalanceUnit;
        }

        public void setPointBalanceUnit(String pointBalanceUnit) {
            this.pointBalanceUnit = pointBalanceUnit;
        }


    }
}
